Imports Clo = Enhancements.Core.Logging
Imports Fun = Enhancements.Basic.Expressions.Functions
Imports Ref = System.Reflection
Imports Sys = System

Namespace Enhancements.Basic.Expressions
    ''' <summary>The exception that is thrown when two functions using the same operator have equal signatures.</summary>
    <Serializable(), DebuggerStepThrough()> _
    Public NotInheritable Class CompilerFunctionsWithSameOperatorHaveEqualSignaturesException
        Inherits CompilerException

        Private Sub New(ByVal _function1 As Fun.Function, ByVal _function1Signature As Fun.FunctionSignature, ByVal _function2 As Fun.Function, ByVal _function2Signature As Fun.FunctionSignature)
            Function1 = _function1
            Function1Signature = _function1Signature
            Function2 = _function2
            Function2Signature = _function2Signature
        End Sub

        Private __Function1 As Fun.Function = Nothing
        ''' <summary>Gets the first function that caused this exception.</summary>
        Public Property Function1() As Fun.Function
            Get
                Return __Function1
            End Get
            Private Set(ByVal _value As Fun.Function)
                __Function1 = _value
            End Set
        End Property

        Private __Function1Signature As Fun.FunctionSignature = Nothing
        ''' <summary>Gets the first function signature that caused this exception.</summary>
        Public Property Function1Signature() As Fun.FunctionSignature
            Get
                Return __Function1Signature
            End Get
            Private Set(ByVal _value As Fun.FunctionSignature)
                __Function1Signature = _value
            End Set
        End Property

        Private __Function2 As Fun.Function = Nothing
        ''' <summary>Gets the second function that caused this exception.</summary>
        Public Property Function2() As Fun.Function
            Get
                Return __Function2
            End Get
            Private Set(ByVal _value As Fun.Function)
                __Function2 = _value
            End Set
        End Property

        Private __Function2Signature As Fun.FunctionSignature = Nothing
        ''' <summary>Gets the second function signature that caused this exception.</summary>
        Public Property Function2Signature() As Fun.FunctionSignature
            Get
                Return __Function2Signature
            End Get
            Private Set(ByVal _value As Fun.FunctionSignature)
                __Function2Signature = _value
            End Set
        End Property

        ''' <summary>Throws an exception.</summary>
        ''' <param name="_function1">First function that is causing the exception.</param>
        ''' <param name="_function1Signature">First function signature that is causing the exception.</param>
        ''' <param name="_function2">Second function that is causing the exception.</param>
        ''' <param name="_function2Signature">Second function signature that is causing the exception.</param>
        ''' <exception cref="CompilerFunctionsWithSameOperatorHaveEqualSignaturesException"> </exception>
        Friend Shared Sub ___Throw(ByVal _function1 As Fun.Function, ByVal _function1Signature As Fun.FunctionSignature, ByVal _function2 As Fun.Function, ByVal _function2Signature As Fun.FunctionSignature)
            Dim _exception As CompilerFunctionsWithSameOperatorHaveEqualSignaturesException = New CompilerFunctionsWithSameOperatorHaveEqualSignaturesException(_function1, _function1Signature, _function2, _function2Signature)

            Throw _exception
        End Sub

    End Class
End Namespace
